<?php
class LogModel extends Db
{
    protected $_log = 'w_log';
    
    /**
     * 增加日志记录
     * @param unknown_type $params
     */
    public function addLog($params)
    {
        $this->add($this->_log, $params);
    }
    
    /**
     * 获取今天第几个登录
     * Enter description here ...
     */
    public function getTodayRank($time)
    {
        $sql = "select count(username) num from w_log WHERE `date`>$time";
        return $this->fetch($sql);
    }
    
    /**
     * 获取日志列表
     * Enter description here ...
     * @param unknown_type $start
     * @param unknown_type $num
     */
    public function getLogPage($start, $num)
    {
        $this->getPage($start, $num, $this->_log);
    }
    
    /**
     * 获取指定记录
     * Enter description here ...
     * @param unknown_type $where
     */
    public function getLogByWhere($where, $limit)
    {
        return $this->getAll($this->_log, $where, NULL, "id DESC", $limit);
    }
    /**
     * 返回log
     * @return LogModel
     */
    public static function instance()
    {
        return parent::_instance(__CLASS__);
    }
}